remove all html tags from string javascript

150

remove all html tags from string javascript -

myString.replace(/<[^>]*>?/gm, '');

remove html between 2 tags javas -

var myString = "<table><tr><td>Some text ...<a href='#'>label...</a></td></tr></table";
myString += "<table><tr><td>Some text ...<a href='#'>label...</a></td></tr></table";
myString += "<table><tr><td>Some text ...<a href='#'>label...</a></td></tr></table";

console.log(myString);

var anchorTagsRemoved = myString.replace(/<a.*>.*?<\/a>/ig,'');
console.log(anchorTagsRemoved);

Comments

Submit
0 Comments